package pl.pr3sto.security

import pl.pr3sto.enums.AccountStatus;

class Profile {
	
	String login
	String password
	AccountStatus status = AccountStatus.NEW
	Role role = Role.USER
	Person person

    static constraints = {
		login(unique: true, blank: false)
    }
	
	static mapping = {
	// TODO: @KM add test
		person(lazy:false, cascade: 'save-update')
	}
	
	static Profile getGuest() {
		return Profile.findByRole(Role.GUEST)
	}
	
	String toString() {
		return person.toString()
	}
}
